<?php 
$con= mysql_connect("localhost","root","");

if(!$con){
die('Connection Error!:' . mysql_error());
}
mysql_select_db ("usabilityevaluation",$con);

if (isset($_GET['DeleteP']) && ($_GET['DeleteP'] == 'DeleteP'))
{
		header("Location: deleteParticipant.php"); 
}

if (isset($_GET['idParticipant']))
{
$idP=$_GET['idParticipant'];
}
	
$firstName=$_POST['textfirstname'];
$lastName=$_POST['textlastname'];
$sexe=$_POST['sex'];
$rightHanded=$_POST['rightHanded'];
$comment=$_POST['textareaComment'];

if($sexe=="M")
	$sexe=1;
else
	$sexe=0;	

if($rightHanded=="R")
	$rightHanded=1;
else
	$rightHanded=0;

if($_POST['newParticipant'] == 'Create') {
$query1="INSERT INTO Participant (FirstName, LastName, isMale, isRightHanded, Comment) VALUES ('$firstName ','$lastName','$sexe ','$rightHanded','$comment')";
mysql_query($query1) or die('Error, insert query failed'); 
}

header("Location: ListeParticipants.php"); 
mysql_close($con);
?>



